package com.yuong.echart;

import java.util.List;

/**
 * 〈玫瑰图配置〉
 *
 * @author yuandong
 * @create 2021/5/29
 * @since 1.0.0
 */
public class RoseOption {
    public String backgroundColor = "#ffffff";
    public VisualMap visualMap = new VisualMap();
    public Legend legend = new Legend();
    public Tooltip tooltip = new Tooltip();
    public List<SeriesBean> series;

    public Legend getLegend() {
        return legend;
    }

    public void setSeries(List<SeriesBean> series) {
        this.series = series;
    }

    public static class VisualMap {
        public boolean show = false;
        public int min = 80;
        public int max = 600;
        public InRange inRange = new InRange();

        public static class InRange {
            public int[] colorLightness = {0, 1};
        }
    }

    public static class Legend {
        public String orient = "horizontal";
        public String x = "center";
        public String y = "bottom";
        public int itemHeight = 8;
        public int itemWidth = 8;
        public TextStyle inRange = new TextStyle();
        public List<String> data;

        public static class TextStyle {
            public int fontSize = 12;
        }

        public void setData(List<String> data) {
            this.data = data;
        }
    }

    public static class Tooltip {
        public String trigger = "item";
        public String formatter = "{b} : {c} ({d}%)";
    }

    public static class SeriesBean {
        public String name = "数据来源";
        public String type = "pie";
        public String radius = "55%";
        public String sort = "ascending";
        public String roseType = "angle";
        public List<PieBean> data;

        public void setData(List<PieBean> data) {
            this.data = data;
        }
    }

    public static class PieBean {
        public double value;
        public String name;
        public ItemStyle itemStyle;
        public Label label;

        public void setValue(double value) {
            this.value = value;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setItemStyle(ItemStyle itemStyle) {
            this.itemStyle = itemStyle;
        }

        public void setLabel(Label label) {
            this.label = label;
        }

        public static class ItemStyle {
            public String color;

            public void setColor(String color) {
                this.color = color;
            }
        }

        public static class Label {
            public String color;

            public void setColor(String color) {
                this.color = color;
            }
        }
    }
}